import logging

# # 显示日志到控制台
# logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(name)s %(message)s')
# 显示日志到文件
logging.basicConfig(filename=r'log.log',level=logging.DEBUG, format='%(asctime)s %(levelname)s %(name)s %(message)s')

# 以下是5个级别的输出语句
logging.debug('this is a debug')
logging.info('this is a info')
logging.warning('this is a warning')
logging.error('this is a error')
logging.critical('this is a critical')
